/**
 * @ClassName LC2319
 * @Author ykx
 * @Date 2024/7/11 21:38
 * @Version 1.0
 */
public class LC2319 {
    public static void main(String[] args) {

    }

    public boolean checkXMatrix(int[][] grid) {
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j < grid[i].length; j++) {
                // 对角线元素不为0
                if (i == j || i + j == grid.length - 1) {
                    if (grid[i][j] == 0) {
                        return false;
                    }
                } else {
                    if (grid[i][j] != 0) {
                        return false;
                    }
                }
            }
        }
        return true;
    }

}
